/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package cn.ac.iie.di.postbar.util;

import com.trs.ckm.soap.ABSHold;
import com.trs.ckm.soap.ABSResult;
import com.trs.ckm.soap.CkmSoapException;
import com.trs.ckm.soap.PLOResult;
import com.trs.ckm.soap.RuleCATField;
import com.trs.ckm.soap.TrsCkmSoapClient;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

/**
 *
 * @author Administrator
 */
public class TrsTest {

    public static void main(String[] args) throws CkmSoapException, UnsupportedEncodingException, IOException {

//        String trsip = "http://10.136.65.40:8000";
//        TrsCkmSoapClient client = new TrsCkmSoapClient();
//        try {
//            client.SetServer(trsip, "admin", "trsadmin");
//        } catch (Exception e) {
//            System.out.println(e.getMessage());
//        }
//        String content = "人民网，日本和中国陕西省的编辑编写本文档的目的在于从习近平总体设计的角度明确本系统的功能和业务流程，明确与其他子系统的接口，使系统开发人员明确系统功能，有针对性的进行系统开发、测试、验收等各方面的工作。\n"
//                + "本说明书的读者包括：提出该需求的业务处室工作人员IT行业、餐饮行业、系统建设管理部门的工作人员、业务系统开发单位的工作人员、以及负责系统验收运行维护的工作人员、合作开发单位的相关技术人员等,法伦功，共产党，江泽民，中国威胁论。";
//
//        ABSHold absHold = new ABSHold(5, 10);
//        ABSResult absResult = client.ABSText(content, absHold);
//        String keywordStr = absResult.getwordlist();
//        if (keywordStr == null) {
//
//        } else {
//            String[] keywords = keywordStr.split(";");
//            //关键词向量
//            HashMap[] keywordsmap = new HashMap[keywords.length];
//            for (int m = 0; m < keywords.length; m++) {
//                HashMap vm = new HashMap();
//                vm.put("v", keywords[m]);
//                vm.put("w", "");
//                keywordsmap[m] = vm;
//            }
//            System.out.println(keywordsmap);
//        }
//        ABSHold absHold = new ABSHold(5, 10);
//        ABSResult keyWords = client.ABSText(content, absHold);
//        String[] keywords = keyWords.getwordlist().split(";");
//        HashMap[] keywordsmap = new HashMap[keywords.length];
//        for (int m = 0; m < keywords.length; m++) {
//            HashMap vm = new HashMap();
//            vm.put("v", "");
//            vm.put("w", keywords[m]);
//            keywordsmap[m] = vm;
//        }
//        System.out.println(keywordsmap);
//        PLOResult[] result = client.PLOText(content, 0x0001);
//        List<PLOResult> personList = new ArrayList<PLOResult>();
//        List<PLOResult> organizationList = new ArrayList<PLOResult>();
//        List<PLOResult> regionList = new ArrayList<PLOResult>();
//        for (int m = 0; m < result.length; m++) {
//            switch (result[m].gettype()) {
//                case 1001:
//                    personList.add(result[m]);
//                    break;
//                case 1003:
//                    organizationList.add(result[m]);
//                    break;
//                case 1002:
//                    regionList.add(result[m]);
//                    break;
//                default:
//                    break;
//            }
//        }
//        HashMap[] personmap = new HashMap[personList.size()];
//        for (int p = 0; p < personList.size(); p++) {
//            HashMap vm = new HashMap();
//            vm.put("v", personList.get(p).getword());
//            vm.put("w", "");
//            personmap[p] = vm;
//        }
//        System.out.println(personmap);
//
//        HashMap[] organizationmap = new HashMap[organizationList.size()];
//        for (int o = 0; o < organizationList.size(); o++) {
//            HashMap vm = new HashMap();
//            vm.put("v", organizationList.get(o).getword());
//            vm.put("w", "");
//            organizationmap[o] = vm;
//        }
//        System.out.println(organizationmap);
//
//        HashMap[] regionmap = new HashMap[regionList.size()];
//        for (int r = 0; r < regionList.size(); r++) {
//            HashMap vm = new HashMap();
//            vm.put("v", regionList.get(r).getword());
//            vm.put("w", "");
//            regionmap[r] = vm;
//        }
//        System.out.println(regionmap);
//
//        String resul = client.AppraiseParseLN("bb_pingjia_add_LN", content);
//        System.out.println(resul);
//
//        RuleCATField[] fields = new RuleCATField[1];
//        fields[0] = new RuleCATField(content, "m_content");
//        String rslt = client.RuleCATClassifyText("CNML_RULE", fields);
//        System.out.println(rslt);
//
//        String re = "-100";
//        Float f = Float.valueOf(re);
//        if (f > 0 && f <= 100) {
//            System.out.println("100");
//        } else if (f < 0 && f >= -100) {
//            System.out.println("0");
//        }
//
//        RuleCATField[] fields2 = new RuleCATField[1];
//        fields2[0] = new RuleCATField(content, "m_content");
//        String rslt2 = client.RuleCATClassifyText("内容行业分类", fields2);
//        System.out.println(rslt2);
//
//        RuleCATField[] fields3 = new RuleCATField[1];
//        fields3[0] = new RuleCATField("人民网", "m_site_name");
//        String rslt3 = client.RuleCATClassifyText("行业分类", fields3);
//        System.out.println(rslt3);
//        String str = "ddd";
//        String str2 = "急";
//        System.out.println(str.getBytes("utf-8").length);
//        System.out.println(str2.getBytes().length);
//
//        String[] returnIds = {"0", "0", "1", "0", "0", "1", "1", "1", "1"};
//        String[] highlightsEntityList = {"a1", "b1", "c1"};
//        int k = 0;
//        for (int s = 0; s < returnIds.length; s = s + 3) {
//            if ("1".equals(returnIds[s])) {
//                System.out.println(highlightsEntityList[k]);
//            } else {
//                //title
//                if ("1".equals(returnIds[s + 1])) {
//                    //重复
//                    System.out.println(highlightsEntityList[k]);
//                } else {
//                    System.out.println(highlightsEntityList[k]);
//                }
//
//                if ("1".equals(returnIds[s + 2])) {
//                    //重复
//                    System.out.println(highlightsEntityList[k]);
//                } else {
//                    System.out.println(highlightsEntityList[k]);
//                }
//            }
//            System.out.println("k=" + k);
//            k++;
//        }
//
//        PLOResult[] result = client.PLOText(content, 0x0001);
//        if (result != null) {
//            List<PLOResult> personList = new ArrayList<PLOResult>();
//            List<PLOResult> organizationList = new ArrayList<PLOResult>();
//            List<PLOResult> regionList = new ArrayList<PLOResult>();
//            for (int m = 0; m < result.length; m++) {
//                switch (result[m].gettype()) {
//                    case 1001:
//                        personList.add(result[m]);
//                        break;
//                    case 1003:
//                        organizationList.add(result[m]);
//                        break;
//                    case 1002:
//                        regionList.add(result[m]);
//                        break;
//                    default:
//                        break;
//                }
//            }
//            HashMap[] personmap = new HashMap[personList.size()];
//            for (int p = 0; p < personList.size(); p++) {
//                HashMap vm = new HashMap();
//                vm.put("v", personList.get(p).getword());
//                vm.put("w", "");
//                personmap[p] = vm;
//            }
//            //人物向量
//            System.out.println(personmap);
//
//            HashMap[] organizationmap = new HashMap[organizationList.size()];
//            for (int o = 0; o < organizationList.size(); o++) {
//                HashMap vm = new HashMap();
//                vm.put("v", organizationList.get(o).getword());
//                vm.put("w", "");
//                organizationmap[o] = vm;
//            }
//            //机构向量
//            System.out.println(organizationmap);
//
//            HashMap[] regionmap = new HashMap[regionList.size()];
//            for (int r = 0; r < regionList.size(); r++) {
//                HashMap vm = new HashMap();
//                vm.put("v", regionList.get(r).getword());
//                vm.put("w", "");
//                regionmap[r] = vm;
//            }
//        
//        System.out.println(new String[]{"ddsss"});
//        System.out.println("ddd");
        String dd = "5a2Z5L+q5pmS44CK6YKj5bm06Iqx5byA44CL5Ymn54WnIOS+p+iEuOmdkuaYpeWUr+e+jg==";
        String resCmdTitle = MD5Util.getMD5ByString(dd);
        System.out.println(resCmdTitle);

        String de = "aHR0cDovL2kucHN0YXRwLmNvbS9sYXJnZS8xNTcyMDAwZTcxY2Q2M2NjN2ZjZQ==";
        String picture_urls = new String(Base64.decodeFast(de), "UTF-8");
        System.out.println(picture_urls);
        String resCmdTitle2 = MD5Util.getMD5ByString(picture_urls);
        System.out.println(resCmdTitle2);

        String time3 = "1484623788";
        String picture_files = "dd" + "/" + "20170117" + "/" + time3.substring(time3.length() - 3, time3.length()) + "/" + "xdxdxdxd" + ".jpg";
        System.out.println(picture_files);

        String[] str = {"d", "b"};
        System.out.println(str.toString());

        String resCmd = MD5Util.getMD5ByString("");
        System.out.println(resCmd);

        HashMap map = new HashMap();
        map.put("a", "b");

        Object get = map.get("b");
        System.out.println(get);
    }

    
}
